package workexp.alg.math;

import org.junit.Test;

import java.util.Arrays;

public class CountPrimes {
    public int countPrimes(int n) {
        int result = 0;
        boolean[] notp = new boolean[n];
        for(int i=2;i<n;i++) {
            if (notp[i]) {
                continue;

            }
            result++;
            for (int j = i; j < n; j += i) {
                notp[j] = true;
            }

        }
        return result;
    }

    @Test
    public void test(){
        int result = countPrimes(10);
        System.out.println(result);
    }
}
